using System;
using UnityEngine;
using System.Collections.Generic;

namespace WolfCarol.AvgToolkit.UI
{
    public class UIManager : MonoBehaviour
    {
        public List<PanelBase> panelList = new();

        public void OpenPanel(string _name)
        {
            foreach (var panel in panelList)
            {
                if (panel.gameObject.name == _name)
                {
                    panel.Show();
                    return;
                }
            }

            throw new ArgumentException($"Could not find the panel({_name}).");
        }

        public void ClosePanel(string _name)
        {
            foreach (var panel in panelList)
            {
                if (panel.gameObject.name == _name)
                {
                    panel.Hide();
                    return;
                }
            }

            throw new ArgumentException($"Could not find the panel({_name}).");
        }
    }
}
